<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" type="text/css" href="css/style.css"/>
		<style type="text/css">
			.mui-content .update{
				/* border: 0.0625rem solid red; */
				margin-top: 6rem;
				/* position: relative; */
			}
			.mui-content .update .imgBox{
				/* border: 0.0625rem solid yellow; */
				width: 10%;
				height: 2.5rem;
				margin-top: 0.8rem;
				margin-left: 1rem;
				/* float: left; */
				background-color: white;
			}
			.mui-content .update .imgBox .mui-icon{
				display: block;
				color: gray;
				font-size: 2rem;
				padding-top: 0.2rem;
			}
			.mui-content .update .nameInput{
				/* border: 0.0625rem solid green; */
				width: 80%;
				margin-left: 3rem;
				margin-top: -2.5rem;
			}
			.mui-content .update .nameInput input{
				border: none;
			}
			.mui-content .confirm button{
				width: 95%;
				margin: 0rem auto;
				padding: 0.5rem;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">修改身份证号</h1>
		</header>
		<div class="mui-content">
			<div class="update">
				<div class="imgBox">
					<span class="mui-icon mui-icon-info"></span>
				</div>
				<div class="nameInput mui-input-row">
					<input id="userNum" type="text" class="mui-input-clear" placeholder="填写新的身份证号">
				</div>
			</div>
			<div class="confirm">
				<button type="button" class="mui-btn-block mui-btn-primary">修改</button>
			</div>
		</div>
		
		<script src="js/mui.min.js"></script>
		<script src="js/jquery-2.1.1.min.js" type="text/javascript" charset="utf-8"></script>
		<!-- <script src="http://103.59.149.116:6198/hcys/js/mapi.js" type="text/javascript" charset="utf-8"></script> -->
		<script src="js/Mobile.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/app.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			mui.init()
			
			mui.plusReady(function () {
				mui(".confirm").on("tap", "button", function(){
					var myStorage = JSON.parse(localStorage.getItem("users"));
					var glbToken = myStorage.glbToken;
					var currentWebview = plus.webview.currentWebview();
					var userId = currentWebview.userId;
					// var updateInfo = updateUserInfo()
					if (checkToken(glbToken).status == "ok") {
						var idnum = $("#userNum").val();
						if (idnum == "") {
							alert("户主名不能为空");
						} else{
							var updateInfo = updateUserInfo(userId, "idnum", idnum,glbToken);
							if (updateInfo.status == "ok") {
								mui.toast('修改成功',{ duration:'short', type:'div' });
							} else{
								mui.toast('修改失败',{ duration:'short', type:'div' });
							}
						}
					} else{
						app.setState({});
						plus.webview.getLaunchWebview().show("pop-in");
						setTimeout(function(){
							alert("此账号已在其他设备登录,请重新登录!");
							localStorage.clear();
							plus.runtime.restart();
						},30);
					}
				})
			})
		</script>
	</body>

</html>
